package com.zhanglei.method;

/**
 * @author caesar
 * @date 2025/7/5
 * @apiNote
 */
public class DepositCard {
    private static double CurrentAnnualInterestRate;
    private String cardType;
    private double balance;

    public DepositCard() {
    }

    public DepositCard(String cardType, double balance) {
        this.cardType = cardType;
        this.balance = balance;
    }

    public static double getCurrentAnnualInterestRate() {
        return CurrentAnnualInterestRate;
    }

    public static void setCurrentAnnualInterestRate(double currentAnnualInterestRate) {
        CurrentAnnualInterestRate = currentAnnualInterestRate;
    }

    public String getCardId() {
        return cardType;
    }

    public void setCardId(String cardId) {
        this.cardType = cardId;
    }

    public void withdraw(double money){
        if(money<0){
            System.out.println("取款失败，取款金额不能为负数");
            return;
        }
        if(money>balance){
            System.out.println("取款失败，余额不足");
            return;
        }
        balance -= money;
    }
    public void save(double money){
        if(money<0){
            System.out.println("存款失败，存款金额不能为负数");
            return;
        }
        balance += money;
    }
    public double interset(){
        return balance*CurrentAnnualInterestRate;
    }
    public String getInfo(){
        return "账号,"+cardType+"，余额："+balance+"，当前银行利率："+CurrentAnnualInterestRate+"利息："+interset();
    }

}
